<script type="text/javascript">
	var JsScreenTagMethods = {
		ScreenTagLeftClick(cid){
			var self = this;
			if(this.ScreenValue.tag.leftid == cid){
				return false;
			}
			$('.scrollbarTag .el-scrollbar__wrap')[0].scrollTop = 0;
			this.ScreenValue.tag.leftid = cid;
			var recode = this.ScreenValue.tag.data[cid];
			recode.valloading = false;
			recode.loading = true;
			recode.page = 1;
			recode.finish = true;
			this.ScreenValue.tag.search = '';
			self.$nextTick(function(){
				this.ScreenGetValueData('tag');
			})
		},
		ScreenTagLeftRelativeClick(val){
			if(parseInt(this.ScreenValue.tag.tagrelative) != parseInt(val)){
				this.ScreenValue.tag.tagrelative = val;
				this.ScreenSubmit();
				return false;
			}
		},
		ScreenTagRightSearch:debounce(function(){//输入
			$('.scrollbarTag .el-scrollbar__wrap')[0].scrollTop = 0;
			var recode = this.ScreenValue.tag.data[this.ScreenValue.tag.leftid];
			recode.valloading = false;
			recode.loading = true;
			recode.page = 1;
			recode.data = [];
			recode.finish = true;
			this.ScreenGetValueData('tag');
		},800),
		ScreenTagRightTagChange(tid,text){
			if(this.ScreenValue.tag.value.indexOf(tid)>-1){
				this.ScreenValue.tag.text.push(text);
			}else{
				var index = this.ScreenValue.tag.text.indexOf(text);
				this.ScreenValue.tag.text.splice(index,1);
			}
			this.ScreenSubmit();
		},
		ScreenGetTagGroupNum(ParamData){
			var self = this;
			$.post(MOD_URL+'&op=ajax&operation=search_menu',ParamData,function(data){
				if(data.catdata){
					
					for(var t in self.ScreenValue.tag.data){
						var num = 0;
						for(var i in data.catdata){
							var item = data.catdata[i];
							var cid = item.cid;
							if(parseInt(cid) == 0){
								cid = 'all';
							}
							if(self.ScreenValue.tag.data[t].id == cid){
								num = item.num;
							}
							
						}
						
						self.ScreenValue.tag.data[t].num = num
					}
					
				}else{
					for(var t in self.ScreenValue.tag.data){
						var num = 0;
						self.ScreenValue.tag.data[t].num = num
					}
				}
				self.$forceUpdate();
			},'json');
		},
		ScreenTagScrollEvent(){
			var self = this;
			
			$('.scrollbarTag .el-scrollbar__wrap').unbind('scroll');
			$('.scrollbarTag .el-scrollbar__wrap').bind('scroll',function(){
				var recode = self.ScreenValue.tag.data[self.ScreenValue.tag.leftid];
				var valloading = recode.valloading;
				var loading = recode.loading;
				var finish = recode.finish;
				if(!finish && !loading && !valloading && this.scrollHeight-100 < $(this).scrollTop()+this.clientHeight){
					recode.valloading = true;
					recode.page += 1;
					self.$forceUpdate();
					var param = self.ScreenGetParam('tag');
					param['skey'] = 'tag';
					param['page'] = recode.page;
					if(self.Appid && self.Appid!='all'){
						param['appid'] = self.Appid;
					}
					if(self.ScreenValue.tag.leftid != 'all'){
						param['cid'] = self.ScreenValue.tag.leftid;
					}
					if(self.ScreenValue.tag.search){
						param['tagkeyword'] = self.ScreenValue.tag.search;
					}
					if(self.HeaderKeyword){
						param['keyword'] = self.HeaderKeyword;
					}
					$.post(MOD_URL+'&op=ajax&operation=searchmenu_num',param,function(json){
						for(var g in json.alltagdata){
							recode.data.push({
								tagname:json.alltagdata[g].tagname,
								tid:parseInt(g),
							});
						}
						recode.valloading = false;
						recode.finish = json.finish;
						self.ScreenGetValueData('tag',true,true);
						self.$forceUpdate();
					},'json');
				}
			});
		}
	};
</script>